package com.dong.elasticsearch_demo.controller;

import com.dong.elasticsearch_demo.bean.CommonResult;
import com.dong.elasticsearch_demo.bean.ESRequestParam;
import com.dong.elasticsearch_demo.bean.ESResponseResult;
import com.dong.elasticsearch_demo.service.ProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/search")
@Api(tags = "MemberCollectionController", description = "会员收藏管理")
public class SearchController {
    @Autowired
    ProductService searchService;

    @GetMapping
    @ApiOperation("检索商品")
    public CommonResult<ESResponseResult> listPage(ESRequestParam param) {

        //1、根据传递来的页面的查询参数，去es中检索商品
        ESResponseResult searchResult = searchService.search(param);

        return CommonResult.success(searchResult);
    }
}
